package com.zqxq.lottery.controller.user;

import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.common.constant.Result;
import com.zqxq.common.enums.CodeEnum;
import com.zqxq.lottery.entity.bo.user.UserPrizeBO;
import com.zqxq.lottery.service.user.IUserPrizeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
public class UserPrizeController extends UserBaseController{

    @Autowired
    private IUserPrizeService userPrizeService;

    //分页查询列表
    @PostMapping("/userprize/page")
    public Result page(@RequestBody UserPrizeBO search){
        Result rs = new Result();
        try{
            Page page = userPrizeService.queryPage(search);
            rs.setData(page);
        }catch(Exception e){
            rs.setCode(CodeEnum.FAIL.getCode());
            rs.setMsg(CodeEnum.FAIL.getMsg());
            log.error("UserPrize Page  Error:",e);
        }
        return rs;
    }

}
